import book.Book;
import book.BookList;
import user.Admin;
import user.Normal;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-26
 * Time: 8:47
 */
//图书管理小练习二次梳理
public class Main {

    public static User login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名:");
        String name = scanner.nextLine();
        System.out.println("hello " + name + " 欢迎您使用本练习");
        System.out.println("请输入你的身份:1>管理员 2>用户");
        int choice = scanner.nextInt();
        if( choice == 1){
            return new Admin(name);
        }else{
            return new Normal(name);
        }
    }

    public static void main(String[] args) {
        //整合
        BookList bookList = new BookList();
        //登录
        User user = login();
        while(true){
            int choice = user.menu();
            user.doIOperation(choice,bookList);
        }
    }
}
